package cn.yunhe.action;

import cn.yunhe.entity.User;
import cn.yunhe.service.UserService;
import cn.yunhe.util.BaseAction;
/**
 * Created by Administrator on 2018/4/3.
 */
public class LoginAction extends BaseAction{
    private String username;
    private String password;
    UserService userService = new UserService();


    public String execute() {
        User user = new User(username, password);
        User u = userService.userLogin(user);

        if (u != null) {
            getSession().setAttribute("username",username);
            return "success";
        } else {
            return "fail";
        }

    }


    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }
}
